package com.mashang.bookkeepingbook.controller;

import com.mashang.bookkeepingbook.pojo.entity.Category;
import com.mashang.bookkeepingbook.pojo.entity.Result;
import com.mashang.bookkeepingbook.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class CategoryController {
    @Autowired
    private CategoryService categoryService;
    @GetMapping("/category/type")
    public Result Categorylist() {

        Category category =categoryService.selectByType();
        if (category != null){
            return Result.Success(category);

        }else {
            return Result.Fail("查询失败");

        }
    }
}
